home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2002 January / PC Answers January 2002.7z / PC Answers January 2002.bin / graphics / freepixl / _SETUP.1 / Boxes.pxl < prev    next >
Text File  |  2000-12-23  |  24KB  |  791 lines

  1. {-------------- sample PiXCL source code ------------------------}
  2. { ---- can be freely copied in your programs --------------------}
  3.  
  4. Initialize:
  5.     AppWindowHandle(h,h$,geoflag,PiXCLMajor,PiXCLMinor)
  6.     WinGetActive(Win$)
  7.     UseCoordinates(PIXEL)
  8.     UseBackGround(TRANSPARENT,192,192,192)
  9.     DrawBackGround
  10.     WaitInput(100)  {let NT and 95 catch up}
  11.     InfoMenu(REMOVE)
  12.     SetMenu()
  13.     WinLocate(Win$,200,100,700,620,Res)
  14.  
  15.     Title$ = "2D Drawing and Frame Controls" 
  16.     WinTitle(Win$, Title$)
  17.     DirGet(SourceDir$)
  18.     Flag = 0
  19.  
  20.     SetMenu("Exit!",Leave,
  21.         ENDPOPUP,
  22.         "Test",IGNORE,
  23.         "Modulus",TestModulus,
  24.         "Random",RandNum,
  25.         ENDPOPUP,
  26.         "2D Drawing",IGNORE,
  27.         "Fast Draw",FastDraw,
  28.         SEPARATOR,
  29.         "BoxesR",DrawBoxesR,
  30.         "BoxesP",DrawBoxesP,
  31.         "Ellipses",DrawEllipses,
  32.         "Triangles",DrawTriangles,
  33.         "Polygons",DrawPolygons,
  34.         "Stars",DrawStars,
  35.         "MapleLeaves 1",DrawMapleLeaf1,
  36.         "MapleLeaves 2",DrawMapleLeaf2,
  37.         "Images",DrawImages,
  38.         "Line Style 1",DrawLines,
  39.         "Line Style 2",DrawLines2,
  40.         "Bouncing Shapes",DrawBounce,
  41.         SEPARATOR,
  42.         "DrawCapt",Captions,
  43.         SEPARATOR,
  44.         "Mouse Draw ON",Mouse_DrawOn,
  45.         "MouseDraw OFF",Mouse_DrawOff,
  46.         "MemDC",ReDrawMemoryDC,
  47.         SEPARATOR,
  48.         "Choose Color",GetColor,
  49.         ENDPOPUP,
  50.         "Frame Controls",IGNORE,
  51.         "Button",Control_Button,
  52.         "Caption",Control_Caption,
  53.         "Menu",Control_Menu,
  54.         "Scroll",Control_Scroll,
  55.         "Show All",Control_All,
  56.         ENDPOPUP,
  57.         "Help",IGNORE,
  58.         "2D Drawing",GDIDemoHelp,
  59.         "SetDrawMouse",DrawMouseHelp,
  60.         "View Source",ViewSource,
  61.         SEPARATOR,
  62.         "WinHelp",GetHelp,
  63.         "AboutPiXCL",About,
  64.         ENDPOPUP)
  65.     
  66.         StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
  67.  
  68.         i = 0
  69.         FastDrawFlag = 0
  70.         UseBrush(SOLID,128,128,255)
  71.     
  72. Wait_for_Input:
  73.     WaitInput()
  74.  
  75.  
  76. Leave:
  77.     End
  78.  
  79. FastDraw:
  80.     If FastDrawFlag = 0
  81.         FastDrawFlag = 1
  82.        ChangeMenuItem("Fast Draw",CHECK,Res)
  83.        DrawStatusWinText(0,"Fast 2D Draw mode")
  84.     Else
  85.         FastDrawFlag = 0
  86.        ChangeMenuItem("Fast Draw",UNCHECK,Res)
  87.              DrawStatusWinText(0,"Slow 2D Draw mode")
  88.     Endif
  89.     Goto Wait_for_Input
  90.  
  91. GDIDemoHelp:
  92.     MessageBox(OK,1,INFORMATION,
  93. "The 2D drawing menu top item 'Fast Draw' sets a flag that 
  94. inserts a 64mS delay after each vector or polygon is drawn.
  95.  
  96. Clicking the left mouse in the client area will stop the
  97. draw operations, clear the screen and report the number
  98. of polygons or vectors drawn. You can also select any menu
  99. item. You will notice a delay in the menu item selecting:
  100. this is because the PiXCL script checks for input every
  101. 50 vectors. This delay can be changed in the PXL source 
  102. file if you want.
  103.  
  104. DrawPolygon and DrawTriangle operations are faster than
  105. DrawEllipse.",
  106.     "2D Drawing Options",Res)
  107.  
  108.     Goto Wait_for_Input
  109.  
  110. DrawMouseHelp:
  111.     MessageBox(OK,1,INFORMATION,
  112. "If you start a 2D drawing operation - boxes, ellipses,
  113. polygons or lines - you can stop the draw process without
  114. clearing the background with the 'Mouse Draw On' command.
  115.  
  116. You can select any of the colors for drawing with the 
  117. mouse in the client area by using a Ctrl-Left Mouse click
  118. on a pixel of the desired color. Holding the left mouse
  119. button down will then draw in the selected color as you
  120. move. 
  121.  
  122. To clear the draw mouse, click the right mouse. This is
  123. not the default action, only how the sample program was
  124. written. You could just as easily use the ShiftRightMouse
  125. or a keyboard entry.",
  126.     "Set Draw Mouse Help",Res)
  127.  
  128.     Goto Wait_for_Input
  129.  
  130.  
  131. ViewSource:
  132.     PXL_file$ = SourceDir$ + "\boxes.pxl"
  133.     CmdLine$ = "Notepad " + PXL_file$
  134.     WinShow(Title$,NOTOPMOST,Res)
  135.     Run(CmdLine$)
  136.     Goto Wait_for_Input
  137.  
  138.  
  139. GetColor:
  140.     GetPixel(X,Y,R,G,B,Res)
  141.     UsePen(SOLID,3,R,G,B)
  142.     Goto Wait_for_Input
  143.  
  144. Mouse_DrawOn:
  145.     DrawStatusWinText(1,"Mouse Drawing enabled.")
  146.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  147.     SetCtrlMouse(cx1,cy1,cx2,cy2,DrawBlock,X,Y)
  148.     SetRightMouse(cx1,cy1,cx2,cy2,ReDrawMemoryDC,n,n)
  149.     SetCtrlMouse(cx1,cy1,cx2,cy2,GetColor,X,Y)
  150.     SetMouse()
  151.     SetDrawMouse(FOREGND)
  152.     DrawLine(10,10,100,10)
  153.     Goto Wait_for_Input
  154.  
  155.  
  156. Mouse_DrawOff:
  157.     DrawStatusWinText(1,"Mouse Drawing disabled.")
  158.     SetDrawMouse(DISABLE)
  159.     SetRightMouse()
  160.     Goto Wait_for_Input
  161.  
  162. ReDrawMemoryDC:
  163.     ReDraw
  164.     Goto Wait_for_Input
  165.  
  166. DrawBlock:
  167.     X1 = X - 15     X2 = X + 15
  168.     Y1 = Y - 15     Y2 = Y + 15
  169.     DrawRectangle(X1,Y1,X2,Y2)
  170.     Goto Wait_for_Input
  171.  
  172.  
  173.  
  174.  
  175.  
  176. About:
  177.     AboutPiXCL
  178.     AboutUser("PiXCL Tools Sample Program",
  179. "Windows 2D Draw, Frame Controls and WinHelp access.",
  180. "A variety of shapes can be drawn in fast mode or slow 
  181. mode which waits 64mS between each draw operation. 
  182. Click the left mouse in the client area to stop.
  183. Frame controls can be drawn any size or position.")
  184.     Goto Wait_for_Input
  185.  
  186. Control_Button:
  187.     DrawStatusWinText(1,"Frame controls built into PiXCL.")
  188.     DrawBackground
  189.     DrawFrameControl(0,0,40,40,BUTTONRADIO,INACTIVE,Res)
  190.     DrawFrameControl(50,0,90,40,BUTTONPUSH,INACTIVE,Res)
  191.     DrawFrameControl(100,0,140,40,BUTTON3STATE,INACTIVE,Res)
  192.     DrawFrameControl(150,0,190,40,BUTTONCHECK,INACTIVE,Res)
  193.         SetMouse(0,0,40,40,Ctl,X,Y)
  194.     SetRightMouse(0,0,40,40,Ctr,X,Y)
  195.     Goto Wait_for_Input
  196. Ctl:
  197.     DrawFrameControl(0,0,40,40,BUTTONRADIO,PUSHED,Res)
  198.  
  199.     Goto Wait_for_Input
  200. Ctr:
  201.     DrawFrameControl(0,0,40,40,BUTTONRADIO,CHECKED,Res)
  202.  
  203.     Goto Wait_for_Input
  204.  
  205. Control_Caption:
  206.     DrawStatusWinText(1,"Caption control built into PiXCL.")
  207.     DrawBackground
  208.     DrawFrameControl(0,0,40,40,CAPTIONCLOSE,CHECKED,Res)
  209.     DrawFrameControl(50,0,90,40,CAPTIONHELP,FLAT,Res)
  210.     DrawFrameControl(100,0,140,40,CAPTIONMAX,INACTIVE,Res)
  211.     DrawFrameControl(150,0,190,40,CAPTIONMIN,MONO,Res)
  212.     DrawFrameControl(200,0,240,40,CAPTIONRESTORE,PUSHED,Res)
  213.  
  214.     Goto Wait_for_Input
  215.  
  216. Control_Menu:
  217.     DrawStatusWinText(1,"Frame controls built into PiXCL.")
  218.     DrawBackground
  219.     DrawFrameControl(0,0,40,40,MENUARROW,CHECKED,Res)
  220.     DrawFrameControl(50,0,90,40,MENUBULLET,FLAT,Res)
  221.     DrawFrameControl(100,0,140,40,MENUCHECK,INACTIVE,Res)
  222.     DrawFrameControl(150,0,190,40,MENUARROW,MONO,Res)
  223.     DrawFrameControl(200,0,240,40,MENUARROW,PUSHED,Res)
  224.  
  225.     Goto Wait_for_Input
  226.  
  227. Control_Scroll:
  228.     DrawStatusWinText(1,"Frame controls built into PiXCL.")
  229.     DrawBackground
  230.     DrawFrameControl(0,0,40,40,SCROLLCOMBOBOX,CHECKED,Res)
  231.     DrawFrameControl(50,0,90,40,SCROLLDOWN,FLAT,Res)
  232.     DrawFrameControl(100,0,140,40,SCROLLLEFT,INACTIVE,Res)
  233.     DrawFrameControl(150,0,190,40,SCROLLRIGHT,MONO,Res)
  234.     DrawFrameControl(200,0,240,40,SCROLLSIZEGRIP,PUSHED,Res)
  235.     DrawFrameControl(250,0,290,40,SCROLLUP,PUSHED,Res)
  236.  
  237.     Goto Wait_for_Input
  238.  
  239.  
  240. Control_All:
  241.     DrawStatusWinText(1,"Frame controls built into PiXCL.")
  242.     DrawBackground
  243.     DrawFrameControl(0,0,40,40,BUTTONRADIO,INACTIVE,Res)
  244.     DrawFrameControl(50,0,90,40,BUTTONPUSH,INACTIVE,Res)
  245.     DrawFrameControl(100,0,140,40,BUTTON3STATE,INACTIVE,Res)
  246.     DrawFrameControl(150,0,190,40,BUTTONCHECK,INACTIVE,Res)
  247.  
  248.     DrawFrameControl(0,50,40,90,CAPTIONCLOSE,CHECKED,Res)
  249.     DrawFrameControl(50,50,90,90,CAPTIONHELP,FLAT,Res)
  250.     DrawFrameControl(100,50,140,90,CAPTIONMAX,INACTIVE,Res)
  251.     DrawFrameControl(150,50,190,90,CAPTIONMIN,MONO,Res)
  252.     DrawFrameControl(200,50,240,90,CAPTIONRESTORE,PUSHED,Res)
  253.  
  254.     DrawFrameControl(0,100,40,140,MENUARROW,CHECKED,Res)
  255.     DrawFrameControl(50,100,90,140,MENUBULLET,FLAT,Res)
  256.     DrawFrameControl(100,100,140,140,MENUCHECK,INACTIVE,Res)
  257.     DrawFrameControl(150,100,190,140,MENUARROW,MONO,Res)
  258.     DrawFrameControl(200,100,240,140,MENUARROW,PUSHED,Res)
  259.  
  260.     DrawFrameControl(0,150,40,190,SCROLLCOMBOBOX,CHECKED,Res)
  261.     DrawFrameControl(50,150,90,190,SCROLLDOWN,FLAT,Res)
  262.     DrawFrameControl(100,150,140,190,SCROLLLEFT,INACTIVE,Res)
  263.     DrawFrameControl(150,150,190,190,SCROLLRIGHT,MONO,Res)
  264.     DrawFrameControl(200,150,240,190,SCROLLSIZEGRIP,PUSHED,Res)
  265.     DrawFrameControl(250,150,290,190,SCROLLUP,PUSHED,Res)
  266.  
  267.     UseFont("Arial",6,17,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  268.     DrawText(200,5,"Button Controls")    
  269.     DrawText(250,55,"Caption Controls")    
  270.     DrawText(250,105,"Menu Controls")    
  271.     DrawText(300,155,"Scroll Controls")    
  272.  
  273.     Goto Wait_for_Input
  274.  
  275.  
  276. Captions:
  277.     DrawCaption("",10,  0,150, 30,  ICON,COLOR,INBUTTON,Res)
  278.     DrawCaption("",10, 30,150, 55,  ICON,COLOR,NOINBUTTON,Res)
  279.     DrawCaption("",10, 60,150, 85,NOICON,COLOR,NOINBUTTON,Res)
  280.     DrawCaption("",10, 90,150,115,NOICON,SMALLCAP,INBUTTON,Res)
  281.     DrawCaption("",10,120,150,145,NOICON,SMALLCAP,NOINBUTTON,Res)
  282.     
  283.     UseFont("Arial",6,17,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  284.     DrawText(155,5,"ICON,COLOR,INBUTTON")
  285.     DrawText(155,35,"ICON,COLOR,NOINBUTTON")
  286.     DrawText(155,65,"NOICON,COLOR,NOINBUTTON")
  287.     DrawText(155,95,"NOICON,SMALLCAP,INBUTTON")
  288.     DrawText(155,125,"NOICON,SMALLCAP,NOINBUTTON")
  289.  
  290.     Goto Wait_for_Input
  291.  
  292. GetHelp:
  293.     DrawStatusWinText(1,"Using the WinHelp command.")
  294.     HelpFile$ = SourceDir$ + "\pixclhlp.hlp"
  295.     WinHelp(HelpFile$,CONTENTS,"")
  296.     Goto Wait_for_Input
  297.  
  298. TestModulus:
  299.     DrawStatusWinText(1,"Getting a modulus number.")
  300.     DrawBackGround Flag = 0
  301.     DrawText(10,3,"Modulus 10 operations")
  302.     Random(1000,J)
  303.     DrawNumber(10,20, J)
  304.     K = J % 10   DrawNumber(10,45, K)
  305.     Negate(K)    DrawNumber(50,45, K)
  306.     Goto Wait_for_Input
  307.  
  308. RandNum:
  309.     DrawStatusWinText(1,"Generating random numbers")
  310.     DrawBackGround Flag = 0
  311.     Random(1000,Ran1) DrawNumber(10,10,Ran1)
  312.     Random(255,Ran2) DrawNumber(10,35,Ran2)
  313.     Goto Wait_for_Input
  314.  
  315. DrawBoxesR:
  316.     DrawStatusWinText(1,"Drawing random size and position boxes.")
  317.     If Flag = 0 Then DrawBackGround Flag = 1
  318.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  319.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  320.     DrawStatusWinText(0,"Click client area to stop")
  321.  
  322.  
  323. Loop1:
  324.     Random(cx2,X1) Random(cy2,Y1)
  325.     Random(128,Xsize) Random(128,Ysize)
  326.     Random(255,R) Random(255,G)  Random(255,B)
  327.     X2 = X1 + Xsize   Y2 = Y1 + Ysize
  328.     UsePen(SOLID,1,B,R,G)
  329.     UseBrush(SOLID,R,G,B)
  330.     DrawRectangle(X1,Y1,X2,Y2)
  331.     If FastDrawFlag = 0 Then WaitInput(1)
  332.     i = i + 1    j = i % 50
  333.     If j = 5 Then DrawStatusWinText(1,"Drawing random size and position boxes.")
  334.  
  335.     If j = 0 
  336.         WaitInput(1) 
  337.         Str(i,i$)  
  338.         i$ = i$ + " 2D draw operations"
  339.         DrawStatusWintext(1,i$)
  340.     Endif
  341.  
  342.     Goto Loop1
  343.  
  344. DrawBoxesP:
  345.     DrawStatusWinText(1,"Drawing random size and position boxes.")
  346.     If Flag = 0 Then DrawBackGround Flag = 1
  347.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  348.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  349.     DrawStatusWinText(0,"Click client area to stop")
  350. Loop1a:
  351.     Random(cx2,X1) Random(cy2,Y1)
  352.     Random(128,Xsize) Random(128,Ysize)
  353.     Random(255,R) Random(255,G)  Random(255,B)
  354.     X2 = X1 + Xsize      Y2 = Y1
  355.     X3 = X1 + Xsize   Y3 = Y1 + Ysize
  356.     X4 = X1          Y4 = Y1 + Ysize
  357.     UsePen(SOLID,1,B,R,G)
  358.     UseBrush(SOLID,R,G,B)
  359.     DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4)
  360.     If FastDrawFlag = 0 Then WaitInput(1)
  361.     i = i + 1    j = i % 50
  362.     If j = 5 Then DrawStatusWinText(1,"Drawing random size and position boxes.")
  363.     If j = 0 
  364.         WaitInput(1) 
  365.         Str(i,i$)  i$ = i$ + " 2D draw operations"
  366.         DrawStatusWintext(1,i$)
  367.     Endif
  368.     Goto Loop1a
  369.  
  370.  
  371. DrawEllipses:
  372.     DrawStatusWinText(1,"Drawing random size and position ellipses.")
  373.     If Flag = 0 Then DrawBackGround Flag = 1
  374.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  375.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  376.     DrawStatusWinText(0,"Click client area to stop")
  377. Loop2:
  378.     Random(1000,X1) Random(768,Y1)
  379.     Random(128,Xsize) Random(192,Ysize)
  380.     Random(255,R) Random(255,G)  Random(255,B)
  381.     X2 = X1 + Xsize   Y2 = Y1 + Ysize
  382.     UsePen(SOLID,1,R,G,B)
  383.     UseBrush(SOLID,R,G,B)
  384.     DrawEllipse(X1,Y1,X2,Y2)
  385.     If FastDrawFlag = 0 Then WaitInput(1)
  386.     i = i + 1    j = i % 50
  387.     If j = 5 Then DrawStatusWinText(1,"Drawing random size and position ellipses.")
  388.     If j = 0 
  389.         WaitInput(1) 
  390.         Str(i,i$)  i$ = i$ + " polygons drawn"
  391.         DrawStatusWintext(1,i$)
  392.     Endif
  393.     Goto Loop2
  394.  
  395. DrawTriangles:
  396.     DrawStatusWinText(1,"Drawing random size and position triangles.")
  397.     If Flag = 0 Then DrawBackGround Flag = 1
  398.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  399.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  400.     DrawStatusWinText(0,"Click client area to stop")
  401. Loop2a:
  402.  
  403.     Random(cx2,X1) Random(cy2,Y1)
  404.     Random(cx2,X2) Random(cy2,Y2)
  405.     Random(cx2,X3) Random(cy2,Y3)
  406.     Random(255,R) Random(255,G)  Random(255,B)
  407.     UsePen(SOLID,1,R,G,B)
  408.     UseBrush(SOLID,G,B,R)
  409.     DrawTriangle(X1,Y1,X2,Y2,X3,Y3)
  410.     If FastDrawFlag = 0 Then WaitInput(1)
  411.     i = i + 1    j = i % 50
  412.     If j = 5 Then DrawStatusWinText(1,"Drawing random size and position triangles.")
  413.     If j = 0 
  414.         WaitInput(1) 
  415.         Str(i,i$)  i$ = i$ + "  triangles drawn"
  416.         DrawStatusWintext(1,i$)
  417.     Endif
  418.     Goto Loop2a
  419.  
  420.  
  421.  
  422. DrawImages:
  423.     DrawStatusWinText(1,"Drawing random size and position images.")
  424.     If Flag = 0 Then DrawBackGround Flag = 1
  425.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  426.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  427.     Image$ = SourceDir$ + "\1iddnext.bmp"
  428.     DrawStatusWinText(0,"Click client area to stop")
  429. Loop3:
  430.     Random(1000,X1) Random(768,Y1)
  431.     Random(500,Xsize) Random(340,Ysize)
  432.     X2 = X1 + Xsize   Y2 = Y1 + Ysize
  433.     
  434.     DrawSizedBitMap(X1,Y1,X2,Y2,Image$)
  435.     If FastDrawFlag = 0 Then WaitInput(1)
  436.     i = i + 1    j = i % 50
  437.     If j = 5 Then DrawStatusWinText(1,"Drawing random size and position images.")
  438.     If j = 0 
  439.         WaitInput(1) 
  440.         Str(i,i$)  i$ = i$ + " 2D draw operations"
  441.         DrawStatusWintext(1,i$)
  442.     Endif
  443.     Goto Loop3
  444.  
  445. DrawLines:
  446.     DrawStatusWinText(1,"Drawing random length and position lines.")
  447.     If Flag = 0 Then DrawBackGround Flag = 1
  448.     UsePen(SOLID,2,255,255,255)
  449.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  450.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  451.     DrawStatusWinText(0,"Click client area to stop")
  452.  
  453. Loop4:
  454.     Random(cx2,X1) Random(cy2,Y1)
  455.     Random(cx2,X2) Random(cy2,Y2)
  456.     Random(255,R) Random(255,G)  Random(255,B)
  457.     UsePen(SOLID,2,R,G,B)
  458.     
  459.     DrawLine(X1,Y1,X2,Y2)
  460.     If FastDrawFlag = 0 Then WaitInput(1)
  461.     i = i + 1    j = i % 50
  462.     If j = 5 Then DrawStatusWinText(1,"Drawing random length and position lines.")
  463.     If j = 0 
  464.         WaitInput(1) 
  465.         Str(i,i$)  i$ = i$ + " 2D draw operations"
  466.         DrawStatusWintext(1,i$)
  467.     Endif
  468.     Goto Loop4
  469.  
  470.  
  471. DrawLines2:
  472.     DrawStatusWinText(1,"Drawing bouncing lines.")
  473.     If Flag = 0 Then DrawBackGround Flag = 1
  474.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  475.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  476.     DrawStatusWinText(0,"Click client area to stop")
  477.     X1 = 100  Y1 = 100
  478.     X2 = X1 + 128  Y2 = Y1 + 128
  479.     IncrX1 = 1  IncrY1 = 2
  480.     IncrX2 = 4  IncrY2 = 6
  481.     Random(255,R) Random(255,G)  Random(255,B)
  482.     UsePen(SOLID,1,R,G,B)
  483.     ColorFlag = 0
  484. Loop5:
  485.     k = i % 1000
  486.     DrawLine(X1,Y1,X2,Y2)
  487.     If FastDrawFlag = 0 Then WaitInput(1)
  488.     X1 = X1 + IncrX1  Y1 = Y1 + IncrY1
  489.     X2 = X2 + IncrX2  Y2 = Y2 + IncrY2
  490.  
  491.     If X1 <= cx1 Then Negate(IncrX1)  ColorFlag = 1
  492.     If X1 >= cx2 Then Negate(IncrX1) 
  493.     If X2 >= cx2 Then Negate(IncrX2)  ColorFlag = 1
  494.     If X2 <= cx1 Then Negate(IncrX2) 
  495.     If Y2 >= cy2 Then Negate(IncrY2)  ColorFlag = 1
  496.     If Y2 <= cy1 Then Negate(IncrY2) 
  497.     If Y1 <= cy1 Then Negate(IncrY1)  ColorFlag = 1
  498.     If Y1 >= cy2 Then Negate(IncrY1) 
  499. {
  500.     R = R + 5  If R >= 255 Then R = 0
  501.     G = G + 5  If G >= 255 Then G = 0
  502.     B = B + 5  If B >= 255 Then B = 0
  503. }
  504.     If  ColorFlag = 1
  505.         Random(255,R) Random(255,G)  Random(255,B)
  506.         UsePen(SOLID,1,R,G,B)
  507.         ColorFlag = 0
  508.     Endif
  509.     i = i + 1    j = i % 50
  510.     If j = 5 Then DrawStatusWinText(1,"Drawing bouncing lines.")
  511.     If j = 0 
  512.         WaitInput(1) 
  513.         Str(i,i$)  i$ = i$ + " 2D draw operations"
  514.         DrawStatusWintext(1,i$)
  515.     Endif
  516.     Goto Loop5
  517.  
  518.  
  519.  
  520.  
  521.  
  522. DrawBounce:
  523.     DrawStatusWinText(1,"Drawing bouncing boxes and ellipses.")
  524.     If Flag = 0 Then DrawBackGround Flag = 1
  525.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  526.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  527.     DrawStatusWinText(0,"Click client area to stop")
  528.     Random(cx2,X1) Random(cy2,Y1)
  529.     X2 = X1 + 48  Y2 = Y1 + 48
  530.     IncrX = 12  IncrY = 12
  531.     Random(255,R) Random(255,G)  Random(255,B)
  532.     UsePen(SOLID,2,R,G,B)
  533.     UseBrush(SOLID,B,R,G)
  534.     ColorFlag = 0
  535. Loop6:
  536.     k = i % 1000
  537.     If k <= 500 Then DrawEllipse(X1,Y1,X2,Y2)
  538.     If k > 500 Then DrawRectangle(X1,Y1,X2,Y2)
  539.     If FastDrawFlag = 0 Then WaitInput(1)
  540.     X1 = X1 + IncrX  Y1 = Y1 + IncrY
  541.     X2 = X1 + 48  Y2 = Y1 + 48
  542.     If X2 > cx2 Then Negate(IncrX) ColorFlag = 1
  543.     If X1 < cx1 Then Negate(IncrX) ColorFlag = 1
  544.     If Y2 > cy2 Then Negate(IncrY) ColorFlag = 1
  545.     If Y1 < cy1 Then Negate(IncrY) ColorFlag = 1
  546.     R = R + 5  If R >= 255 Then R = 0
  547.     G = G + 5  If G >= 255 Then G = 0
  548.     B = B + 5  If B >= 255 Then B = 0
  549.     UseBrush(SOLID,R,G,B)
  550.     If  ColorFlag = 1
  551.         Random(255,R) Random(255,G)  Random(255,B)
  552.         UsePen(SOLID,1,B,R,G)
  553.         UseBrush(SOLID,R,G,B)
  554.         ColorFlag = 0
  555.     Endif
  556.     i = i + 1    j = i % 50
  557.     If j = 5 Then DrawStatusWinText(1,"Drawing bouncing boxes and ellipses.")
  558.     If j = 0 
  559.         WaitInput(1) 
  560.         Str(i,i$)  i$ = i$ + " 2D draw operations"
  561.         DrawStatusWintext(1,i$)
  562.     Endif
  563.     Goto Loop6
  564.  
  565.  
  566. DrawPolygons:
  567.     DrawStatusWinText(1,"Drawing random 9 vertex polygons.")
  568.     If Flag = 0 Then DrawBackGround Flag = 1
  569.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  570.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  571.     DrawStatusWinText(0,"Click client area to stop")
  572.  
  573.     If PiXCLMajor = 4
  574. Loop7:
  575.         Random(cx2,X1) Random(cy2,Y1)
  576.         Random(cx2,X2) Random(cy2,Y2)
  577.         Random(cx2,X3) Random(cy2,Y3)
  578.         Random(cx2,X4) Random(cy2,Y4)
  579.         Random(cx2,X5) Random(cy2,Y5)
  580.         Random(cx2,X6) Random(cy2,Y6)
  581.         Random(cx2,X7) Random(cy2,Y7)
  582.         Random(cx2,X8) Random(cy2,Y8)
  583.         Random(cx2,X9) Random(cy2,Y9)
  584.         Random(255,R) Random(255,G)  Random(255,B)
  585.         UsePen(SOLID,1,R,G,B)
  586.         UseBrush(SOLID,G,B,R)
  587.        DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,X7,Y7,X8,Y8,X9,Y9)
  588.        If FastDrawFlag = 0 Then WaitInput(1)
  589.        i = i + 1    j = i % 50
  590.        If j = 5 Then DrawStatusWinText(1,"Drawing random 9 vertex polygons.")
  591.        If j = 0 
  592.            WaitInput(1) 
  593.            Str(i,i$)  i$ = i$ + "  polygons drawn"
  594.            DrawStatusWintext(1,i$)
  595.        Endif
  596.        Goto Loop7
  597.     Else
  598.         FreeArrayVarAll
  599.         Array(ArrayOfPoints[80],Size)
  600.         i = 0
  601. Loop7a:
  602.         For k = 0 To 79
  603.               Random(cx2,ArrayOfPoints[k] )
  604.         Next
  605.  
  606.         Random(255,R) Random(255,G)  Random(255,B)
  607.         UsePen(SOLID,1,R,G,B)
  608.         UseBrush(SOLID,G,B,R)
  609.        DrawPolygonExt(40,ArrayOfPoints[0],Res)
  610.        If FastDrawFlag = 0 Then  WaitInput(600)
  611.        i = i + 1    j = i % 50
  612.        If j = 5 Then DrawStatusWinText(1,"Drawing random 40 vertex polygons.")
  613.        If j = 0 
  614.            WaitInput(1) 
  615.            Str(i,i$)  i$ = i$ + "  polygons drawn"
  616.            DrawStatusWintext(1,i$)
  617.        Endif
  618.        Goto Loop7a
  619.     Endif
  620.  
  621. DrawStars:
  622.     DrawStatusWinText(1,"Drawing bouncing five point stars.")
  623.     If Flag = 0 Then DrawBackGround Flag = 1
  624.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  625.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  626.     DrawStatusWinText(0,"Click client area to stop")
  627.     Random(cx2,ctX1) Random(cy2,ctY1)
  628.     IncrX = 12  IncrY = 12
  629.     Random(255,R) Random(255,G)  Random(255,B)
  630.     UsePen(SOLID,1,R,G,B)
  631.     UseBrush(SOLID,B,R,G)
  632.     ColorFlag = 0
  633.     GoSub UpDateStarCoords
  634.     DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5)
  635.  
  636. Loop8:
  637.     GoSub UpDateStarCoords
  638.     DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5)
  639.     If FastDrawFlag = 0 Then WaitInput(1)
  640.     ctX1 = ctX1 + IncrX  ctY1 = ctY1 + IncrY
  641.     If ctX1 < cx1 Then Negate(IncrX) ColorFlag = 1
  642.     If ctY1 < cy1 Then Negate(IncrY) ColorFlag = 1
  643.     If ctX1 > cx2 Then Negate(IncrX) ColorFlag = 1
  644.     If ctY1 > cy2 Then Negate(IncrY) ColorFlag = 1
  645.     R = R + 5  If R >= 255 Then R = 0
  646.     G = G + 5  If G >= 255 Then G = 0
  647.     B = B + 5  If B >= 255 Then B = 0
  648.     UseBrush(SOLID,R,G,B)
  649.     If  ColorFlag = 1
  650.         Random(255,R) Random(255,G)  Random(255,B)
  651.         UsePen(SOLID,1,B,R,G)
  652.         UseBrush(SOLID,R,G,B)
  653.         ColorFlag = 0
  654.     Endif
  655.     i = i + 1    j = i % 50
  656.     If j = 5 Then DrawStatusWinText(1,"Drawing bouncing five point stars.")
  657.     If j = 0 
  658.         WaitInput(1) 
  659.         Str(i,i$)  i$ = i$ + "  polygons drawn"
  660.         DrawStatusWintext(1,i$)
  661.     Endif
  662.     Goto Loop8
  663.  
  664. DrawMapleLeaf1:
  665.     DrawStatusWinText(1,"Maple leaves ... hey, we're Canadian !")
  666.     If Flag = 0 Then DrawBackGround Flag = 1
  667.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  668.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  669.     DrawStatusWinText(0,"Click client area to stop")
  670.     Random(cx2,ctX1) Random(cy2,ctY1)
  671.     IncrX = 12  IncrY = 12
  672.     {Random(255,R) Random(255,G)  Random(255,B)}
  673.     R = 255  G = 60  B = 60
  674.     UsePen(SOLID,1,B,R,G)
  675.     UseBrush(SOLID,R,G,B)
  676.     ColorFlag = 0
  677.     GoSub UpDateMapleLeafCoords
  678.     DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,
  679.             X7,Y7,X8,Y8,X9,Y9,X10,Y10,X11,Y11,
  680.             X12,Y12,X13,Y13,X14,Y14,X15,Y15,
  681.             X16,Y16,X17,Y17,X18,Y18,X19,Y19)
  682.  
  683. Loop9:
  684.     ctX1 = ctX1 + IncrX  ctY1 = ctY1 + IncrY
  685.     If ctX1 < cx1 Then Negate(IncrX) ColorFlag = 1
  686.     If ctY1 < cy1 Then Negate(IncrY) ColorFlag = 1
  687.     If ctX1 > cx2 Then Negate(IncrX) ColorFlag = 1
  688.     If ctY1 > cy2 Then Negate(IncrY) ColorFlag = 1
  689.     GoSub UpDateMapleLeafCoords
  690.     DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,
  691.             X7,Y7,X8,Y8,X9,Y9,X10,Y10,X11,Y11,
  692.             X12,Y12,X13,Y13,X14,Y14,X15,Y15,
  693.             X16,Y16,X17,Y17,X18,Y18,X19,Y19)
  694.     If FastDrawFlag = 0 Then WaitInput(1)
  695.     R = R - 3  If R < 0 Then R = 255
  696.     G = G - 3  If G < 0 Then G = 255
  697.     B = B - 3  If B < 0 Then B = 255
  698.     UseBrush(SOLID,R,G,B)
  699.     UsePen(SOLID,1,B,R,G)
  700.     If  ColorFlag = 1
  701.         Random(255,R) Random(255,G)  Random(255,B)
  702.         UsePen(SOLID,1,B,R,G)
  703.         UseBrush(SOLID,R,G,B)
  704.         ColorFlag = 0
  705.     Endif
  706.  
  707.     i = i + 1    j = i % 50
  708.     If j = 0 
  709.         WaitInput(1) 
  710.         Str(i,i$)  i$ = i$ + "  polygons drawn"
  711.         DrawStatusWintext(1,i$)
  712.     Endif
  713.     If j = 15 Then WaitInput(1) DrawStatusWinText(1,"Maple leaf has 19 vertices.")
  714.     If j = 42 Then WaitInput(1) DrawStatusWinText(1,"Maple leaves ? Hey, we're Canadian !")
  715.     Goto Loop9
  716.  
  717.  
  718.  
  719. DrawMapleLeaf2:
  720.     DrawStatusWinText(1,"Maple leaves ... hey, we're Canadian !")
  721.     If Flag = 0 Then DrawBackGround Flag = 1
  722.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  723.     SetMouse(cx1,cy1,cx2,cy2,StopDraw,X,Y)
  724.     DrawStatusWinText(0,"Click client area to stop")
  725.     Random(cx2,ctX1) Random(cy2,ctY1)
  726.     R = 200  G = 110  B = 60
  727.     UsePen(SOLID,1,B,R,G)
  728.     UseBrush(SOLID,R,G,B)
  729.  
  730. Loop10:
  731.     GoSub UpDateMapleLeafCoords
  732.     DrawPolygon(X1,Y1,X2,Y2,X3,Y3,X4,Y4,X5,Y5,X6,Y6,
  733.             X7,Y7,X8,Y8,X9,Y9,X10,Y10,X11,Y11,
  734.             X12,Y12,X13,Y13,X14,Y14,X15,Y15,
  735.             X16,Y16,X17,Y17,X18,Y18,X19,Y19)
  736.     If FastDrawFlag = 0 Then WaitInput(1)
  737.     R = R + 3  If R > 255 Then Random(255,R)
  738.     G = G + 3  If G > 255 Then Random(255,G)
  739.     B = B + 3  If B > 255 Then Random(255,B)
  740.     UseBrush(SOLID,R,G,B)
  741.     UsePen(SOLID,1,B,R,G)
  742.  
  743.     i = i + 1    j = i % 50
  744.     If j = 0 
  745.         WaitInput(1) 
  746.         Str(i,i$)  i$ = i$ + "  polygons drawn"
  747.         DrawStatusWintext(1,i$)
  748.     Endif
  749.     If j = 15 Then WaitInput(1) DrawStatusWinText(1,"Maple leaf has 19 vertices.")
  750.     If j = 42 Then WaitInput(1) DrawStatusWinText(1,"Maple leaves ? Hey, we're Canadian !")
  751.     Random(cx2,ctX1) Random(cy2,ctY1)
  752.     Goto Loop10
  753.  
  754.  
  755.  
  756. StopDraw:
  757.     If PiXCLMajor = 5 Then FreeArrayVarAll 
  758.     DrawBackGround
  759.     DrawNumber(10,10,i)
  760.     Goto Wait_for_Input
  761.  
  762. UpDateMapleLeafCoords: {subroutine}
  763.     X1 = ctX1 + 2     Y1 = ctY1 + 25
  764.     X2 = ctX1 + 2    Y2 = ctY1
  765.     X3 = ctX1 + 40   Y3 = ctY1 + 10
  766.     X4 = ctX1 + 28   Y4 = ctY1 - 5
  767.     X5 = ctX1 + 50   Y5 = ctY1 - 45
  768.     X6 = ctX1 + 31      Y6 = ctY1 - 38
  769.     X7 = ctX1 + 30   Y7 = ctY1 - 58
  770.     X8 = ctX1 + 18      Y8 = ctY1 - 34
  771.     X9 = ctX1 + 18      Y9 = ctY1 - 68
  772.     X10 = ctX1       Y10 = ctY1 - 52
  773.     X11 = ctX1 - 18     Y11 = ctY1 - 68
  774.     X12 = ctX1 - 18  Y12 = ctY1 - 34
  775.     X13 = ctX1 - 30  Y13 = ctY1 - 58
  776.     X14 = ctX1 - 31  Y14 = ctY1 - 38
  777.     X15 = ctX1 - 50  Y15 = ctY1 - 45
  778.     X16 = ctX1 - 28  Y16 = ctY1 - 5
  779.     X17 = ctX1 - 40  Y17 = ctY1 + 10
  780.     X18 = ctX1 - 2   Y18 = ctY1
  781.     X19 = ctX1 - 2   Y19 = ctY1 + 25
  782.     Return
  783.  
  784. UpDateStarCoords: {subroutine}
  785.     X1 = ctX1      Y1 = ctY1 - 60
  786.     X2 = ctX1 + 36  Y2 = ctY1 + 45
  787.     X3 = ctX1 - 54  Y3 = ctY1 - 30
  788.     X4 = ctX1 + 54  Y4 = ctY1 - 30
  789.     X5 = ctX1 - 36  Y5 = ctY1 + 45
  790.     Return
  791.